<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>实时监控</title>
	<#include '/commons/include/head.ftl'>
	
	<link rel="stylesheet" href="${ctx}/static/vendor/bootstrap/css/bootstrap.min.css">
	<script src="${ctx}/static/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="${ctx}/static/vendor/echarts-2.2.7/echarts.js"></script>
</head>

<body style="padding: 10px;overflow-x: hidden;overflow-y: auto;">
	
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<b>线程监控</b>
					<div class="pull-right">
						线程总数
						<span id="threadCount" class="badge">4</span>
					</div>
				</div>
				<div style="padding: 0 10px;">
					<table class="table table-hover" style="margin-bottom: 0px;">
						<thead>
							<tr>
								<th style="height:50px;line-height:34px;">序号</th> 
								<th style="height:50px;line-height:34px;">线程状态</th> 
								<th style="height:50px;line-height:34px;">线程ID</th>
								<th style="height:50px;line-height:34px;">线程名称</th>
								<th style="height:50px;line-height:34px;">lockName</th>
								<th style="height:50px;line-height:34px;">lockOwnerName</th>
								<th style="height:50px;line-height:34px;">cpuTime(秒)</th>
							</tr>
						</thead>
						<tbody id="threadList">
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	
	
	
	<script>
	$(function(){
		var threadList = $("#threadList");
		$.get("${ctx}/manager/system/monitor/monitor_thread", function(result){
			$('#threadCount').html(result.threadCount)
			var index = 1 ;
			$.each(result.moitorThreadinfos, function(p, v) {
				var tr = $("<tr></tr>");
				
				var num = $("<td></td>").html(index++).appendTo(tr);
				var state_td = $("<td></td>").html(v.state).appendTo(tr);
				var id_td = $("<td></td>").html(v.id).appendTo(tr);
				var name_td = $("<td></td>").html(v.name).appendTo(tr);
				var lockName_td = $("<td></td>").html(v.lockName).appendTo(tr);
				var lockOwnerName_td = $("<td></td>").html(v.lockOwnerName).appendTo(tr);
				var cpuTime_td = $("<td></td>").html(v.cpuTime).appendTo(tr);
				
				tr.appendTo(threadList);
			});
			
		}, 'JSON');
	});
	</script>
</body>
</html>

